package com.dynamixsoftware.printershare.snmp;

import java.io.ByteArrayOutputStream;
import java.math.BigInteger;

public class SNMPInteger
  extends SNMPObject
{
  protected byte tag = 2;
  protected BigInteger value;
  
  public SNMPInteger()
  {
    this(0L);
  }
  
  public SNMPInteger(long paramLong)
  {
    this.value = new BigInteger(new Long(paramLong).toString());
  }
  
  public SNMPInteger(BigInteger paramBigInteger)
  {
    this.value = paramBigInteger;
  }
  
  protected SNMPInteger(byte[] paramArrayOfByte)
    throws SNMPBadValueException
  {
    extractValueFromBEREncoding(paramArrayOfByte);
  }
  
  public void extractValueFromBEREncoding(byte[] paramArrayOfByte)
    throws SNMPBadValueException
  {
    try
    {
      this.value = new BigInteger(paramArrayOfByte);
      return;
    }
    catch (NumberFormatException localNumberFormatException)
    {
      throw new SNMPBadValueException(" Integer: bad BER encoding supplied to set value ");
    }
  }
  
  protected byte[] getBEREncoding()
  {
    ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
    byte[] arrayOfByte1 = this.value.toByteArray();
    byte[] arrayOfByte2 = SNMPBERCodec.encodeLength(arrayOfByte1.length);
    localByteArrayOutputStream.write(this.tag);
    localByteArrayOutputStream.write(arrayOfByte2, 0, arrayOfByte2.length);
    localByteArrayOutputStream.write(arrayOfByte1, 0, arrayOfByte1.length);
    return localByteArrayOutputStream.toByteArray();
  }
  
  public Object getValue()
  {
    return this.value;
  }
  
  public void setValue(Object paramObject)
    throws SNMPBadValueException
  {
    if ((paramObject instanceof BigInteger))
    {
      this.value = ((BigInteger)paramObject);
      return;
    }
    if ((paramObject instanceof Integer))
    {
      this.value = new BigInteger(((Integer)paramObject).toString());
      return;
    }
    if ((paramObject instanceof String))
    {
      this.value = new BigInteger((String)paramObject);
      return;
    }
    throw new SNMPBadValueException(" Integer: bad object supplied to set value ");
  }
  
  public String toString()
  {
    return this.value.toString();
  }
  
  public String toString(int paramInt)
  {
    return this.value.toString(paramInt);
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.snmp.SNMPInteger
 * JD-Core Version:    0.7.0.1
 */